package com.business;

import java.util.List;

import android.content.Context;

import com.dataaccess.MyDatabase;
import com.dataobject.MyReminder;

public class ReminderBus {
	private Context context;
	private MyDatabase _MyDB;
	
	public ReminderBus(Context c){
		context = c;
		_MyDB = new MyDatabase(context);
	}

	public MyDatabase get_MyDB() {
		return _MyDB;
	}
	
	public List<MyReminder> getPreviousList(){
		_MyDB.open();
		List<MyReminder> tmp = _MyDB.getPreviousList();
		_MyDB.close();
		return tmp;
	}
	
	public List<MyReminder> getTodayList(){
		_MyDB.open();
		List<MyReminder> tmp = _MyDB.getTodayList();
		_MyDB.close();
		return tmp;
	}
	
	public List<MyReminder> getTomorrowList(){
		_MyDB.open();
		List<MyReminder> tmp = _MyDB.getTomorrowList();
		_MyDB.close();
		return tmp;
	}
	
	public List<MyReminder> getNextList(){
		_MyDB.open();
		List<MyReminder> tmp = _MyDB.getNextList();
		_MyDB.close();
		return tmp;
	}
	
	public int deleteAll() {
		_MyDB.open();
		int tmp = _MyDB.deleteAll();
		_MyDB.close();
		return tmp;
	}
	
	public int deleteReminder(MyReminder mr) {
		_MyDB.open();
		int tmp = _MyDB.deleteReminder(mr);
		_MyDB.close();
		return tmp;
	}
	
	public long insert(MyReminder mr) {
		_MyDB.open();
		long tmp = _MyDB.insert(mr);
		_MyDB.close();
		return tmp;
	}
	
	public boolean updateReminder(MyReminder mr) {
		_MyDB.open();
		boolean tmp = _MyDB.updateReminder(mr);
		_MyDB.close();
		return tmp;		
	}
}
